<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('修改党建答题记录')" />
</head>
<body class="gray-bg">
	
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>修改党建答题记录</h5>
					</div>
					<div class="ibox-content">
						<form class="form-horizontal m" id="form-record-edit" th:object="${examRecord}">
							<input name="id" th:field="*{id}" type="hidden">
							<div class="form-group">
								<label class="col-sm-3 control-label">用户ID：</label>
								<div class="col-sm-8">
									<input name="userId" th:field="*{userId}" class="form-control" type="number" required>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">PK对战ID：</label>
								<div class="col-sm-8">
									<input name="pkBattleId" th:field="*{pkBattleId}" class="form-control" type="number">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">考试类型：</label>
								<div class="col-sm-8">
									<select name="examType" th:field="*{examType}" class="form-control" required>
										<option value="1">单人答题</option>
										<option value="2">PK答题</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">配置ID：</label>
								<div class="col-sm-8">
									<input name="configId" th:field="*{configId}" class="form-control" type="number" required>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">得分：</label>
								<div class="col-sm-8">
									<input name="score" th:field="*{score}" class="form-control" type="number">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">总题数：</label>
								<div class="col-sm-8">
									<input name="totalQuestion" th:field="*{totalQuestion}" class="form-control" type="number">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">答对题数：</label>
								<div class="col-sm-8">
									<input name="correctQuestion" th:field="*{correctQuestion}" class="form-control" type="number">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">答错题数：</label>
								<div class="col-sm-8">
									<input name="wrongQuestion" th:field="*{wrongQuestion}" class="form-control" type="number">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">用时(秒)：</label>
								<div class="col-sm-8">
									<input name="useTime" th:field="*{useTime}" class="form-control" type="number">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">答题时间：</label>
								<div class="col-sm-8">
									<input name="examDate" th:field="*{examDate}" class="form-control" type="datetime-local">
								</div>
							</div>
							<div class="form-group">
								<div class="form-control-static col-sm-offset-9">
									<button type="submit" class="btn btn-primary">提交</button>
									<button type="button" class="btn btn-danger" onclick="closeItem()">关闭</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<th:block th:include="include :: footer" />
	
	<script type="text/javascript">
		var prefix = ctx + "system/exam/record";
		
		$("#form-record-edit").validate({
			rules: {
				userId: {
					required: true,
					digits: true
				},
				examType: {
					required: true
				},
				configId: {
					required: true,
					digits: true
				}
			},
			messages: {
				userId: {
					required: "请输入用户ID",
					digits: "用户ID必须为整数"
				},
				examType: {
					required: "请选择考试类型"
				},
				configId: {
					required: "请输入配置ID",
					digits: "配置ID必须为整数"
				}
			},
			submitHandler: function(form) {
				$.operate.save(prefix + "/edit", $('#form-record-edit').serialize());
			}
		});
		
		function closeItem() {
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		}
	</script>
</body>
</html>